"""
    为login app配置路由
"""

from django.contrib import admin
from django.urls import path, re_path
from . import views

app_name = 'login'

urlpatterns = [
    path('login/', views.LoginView.as_view(), name='login'),  # 登录路由
    path('register/', views.RegisterView.as_view(), name='register'),  # 注册路由
    path('quit/', views.quit, name='quit'),  # 注销视图
    # path('verify_account/', views.verify_account, name='verify_account'),  # 前端验证
    # 用户名重复验证视图
    re_path(r'usernames/(?P<username>[a-zA-Z0-9_\u4e00-\u9fa5\s·]+)/count/$', views.UsernameCountView.as_view(),
            name='username_count'),
    # 手机号重复验证视图
    re_path(
        r'phones/(?P<phone>[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8})/count/$',
        views.PhoneCountView.as_view(), name='phone_count'),
    # 邮箱重复验证视图
    re_path(r'emails/(?P<email>[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)/count/$',
            views.EmailCountView.as_view(), name='email_count'),
]
